#include "LocalResourceElement.h"
//necessary
#include "memory-tools.h"
#include "main-tools.h"

//TODO testing
PlocalResourceElement initLocalResourceElement(char* _name,Pschema schema,PassMode _passmode){
	PlocalResourceElement result=(PlocalResourceElement)mallocMemory(sizeof(LocalResourceElement),"LocalResourceElement.c:initLocalResourceElement:1");
	result->name=_name;
	result->schema=schema;
	result->mode=_passmode;
	return result;
}
//TODO testing
void freeLocalResourceElement(PlocalResourceElement obj){
	//passmode is ignored
	//obj->name will be freed when freeSyntaxTree() is called; so freeing it here would create memory leaks
	//schema must be freed
	freeSchema(obj->schema);
	//free the localResourceElement space itself
	freeMemory(sizeof(LocalResourceElement),obj);
}
//TODO testing
void printLocalResourceElement(FILE* f,PlocalResourceElement obj){
	printPassMode(f,obj->mode);
	fprintf(f," %s ",obj->name);
	printSchema(f,obj->schema);
}

//TODO testing
void generateDOTLocalResourceElement(FILE* f,PlocalResourceElement obj,int* startnode,int* cellnumber,int format){
	printPassMode(f,obj->mode);
	fprintf(f," %s",obj->name);
}
